<template>
  <div id="father">
    <div class="son">
      <div class="tds">业务编号</div>
      <div class="tds" v-for="(n,index) in service" :key="index">
        {{n.servicenumber}}
      </div>
    </div>
    <div class="son">
      <div class="tds">业务类型</div>
      <div class="tds" v-for="(s,index) in servicetypes" :key="index">
        {{s}}
      </div>
    </div>
    <div class="son">
      <div class="tds">业务状态</div>
      <div class="tds" v-for="(se,index) in servicestatus" :key="index">
        {{se}}
      </div>
    </div>
    <div class="son">
      <div class="tds">申请人</div>
      <div class="tds" v-for="(p,index) in proposers" :key="index">
        {{p}}
      </div>
    </div>

    <div class="son">
      <div class="tds">受理时间</div>
      <div class="tds" v-for="(t,index) in times" :key="index">
        {{t}}
      </div>
    </div>
    <div class="son">
      <div class="tds">操作</div>
      <div class="tds" v-for="(s,index) in service" :key="index">
        <input type="button" class="but" value="载入登记簿" @click="shanzheng(s.serviceid,s.proposer,index)"/>
      </div>
    </div>
    <div>

    </div>

  </div>
</template>


<script>
export default {
  name: "ShengHe",
  data(){
    return{
      times : null,
      time :null,
      servicetypes:null,
      servicestatus:null,
      proposers:null,
      service:null,
      serviceid:null,
      roomids: null,
      uid:null,
    }
  },

  mounted() {
    this.show();
  },
  methods: {
    show() {
      this.sa.ajax("/yewu/findshanzheng", {},
          function (resp) {
            var maintime = resp.data.time;
            console.log(resp);
            this.times = maintime;
            for (let i = 0; i < this.times.length; i++) {
              maintime[i]= this.sa.forDate(this.times[i],2);
            }
            this.time=maintime;
            this.servicetypes =resp.data.servicetype;
            this.servicestatus=resp.data.servicestatus;
            this.proposers=resp.data.proposers;
            this.service=resp.data.service.list;
            this.roomids =resp.data.roomids;
            this.uid = resp.data.uid;
          }.bind(this),
          {type: 'get'}
      )
    },
    shanzheng(id,sqr,num){
      this.sa.ajax("/shen/dengjibu", {
            serviceid:id,
            uid:this.uid[num],
            clientid:sqr,
            roomid:this.roomids[num]
          },
          function (){
            alert("已记载至登记簿");
            this.show();
          }.bind(this),
          {type: 'post'}
      )
    }
  }
}
</script>

<style scoped>
#father{
  width: 100%;
  height: 800px;
  padding-left: 5%;
}
.son{
  float: left;
  width: 15%;
  height: 100%;
}
.tds{
  float: left;
  width: 100%;
  height: 30px;
  border-top: 1px black solid;
  border-bottom:1px black solid;
  text-align: center;
  font-size: 110%;
}
.but{
  border-radius: 10px;
  background-color: #42b983;
  color: white;
  border: 2px seagreen solid;
  width: 80px;
  height: 95%;
}
</style>
